<template>
  <div class="page-header">
    <div class="page-header__left" @click="$emit('back')">
      <i class="el-icon-back"></i>
      <div class="page-header__title">
        <slot name="title">{{ title }}</slot>
      </div>
    </div>
    <div class="page-header__content">
      <slot name="content">{{ content }}</slot>
    </div>
  </div>
</template>

<script>

export default {
  name: "PageHeader",
  props: {
    title: {
      type: String,
      default() {
        return '返回';
      }
    },
    content: String
  }
}
</script>

<style lang="scss" scoped>
.page-header {
  display: flex;
  padding: 0 20px;
  height: 64px;
  overflow: hidden;
  border-bottom: 1px solid rgba(204, 204, 204, 0.72);
  box-sizing: border-box;

  .page-header__left {
    display: flex;
    cursor: pointer;
    margin-right: 40px;
    position: relative;
    align-items: center;

    .el-icon-back {
      font-size: 18px;
      margin-right: 6px;
    }

    .page-header__title {
      font-size: 14px;
      font-weight: 500;

      &::after {
        content: "";
        position: absolute;
        width: 1px;
        height: 16px;
        right: -20px;
        top: 50%;
        transform: translateY(-50%);
        background-color: #dcdfe6;
      }
    }
  }

  .page-header__content {
    flex: 1;
    display: flex;
    align-items: center;
  }

  ::v-deep + * {
    height: calc(100% - 64px) !important;
    overflow-y: auto;
    box-sizing: border-box;
  }
}
</style>
